WDV221 Intro Javascript

Project-5 Loops In Class Exercises

 

Instructions:

Please complete the following exercises using Javascript loops as indicated. Please place your code on this page. Use runtime scripts unless told otherwise.

1. Create a For loop that will print out the numbers 0 to 4 each on a seperate line.

2. Create a For loop that will print out the numbers 4 to 0 each on a seperate line.

3. Create a For loop that will print out even numbers from 2 to 10 each on a seperate line.

4. Create a While loop that will print out the numbers 1 to 5 each on a seperate line.

5. Create a While loop that will print out then numbers 5 to 1 each on a seperate line.

6. Create a For loop that will print the following lines. Each line should be in a paragraph element.

Number: 1
Number: 2
Number: 3

7. Create a loop that will print out 2- 20 by twos. Example: 2 4 6 8 ...

8. Create a loop that will print out the following numbers (5,10,15,20,25...) until one is greater than 40.

9. Create a loop that will print out 6 of the following messages (Option 1, Option 2, Option 3, etc. ) as list items within the list below.

    Please Select one of the following options:

10. Create a While loop that will use a prompt to ask the user for a number. The body of the loop will print out a message "The number is: ?" with the number entered. The loop will end when the user enters a number greater than 100.